import { Map} from "immutable";

const defaultState=Map({
    data:Map({
        "data": {
            "1/20": "50.0",
            "1/21": "52.0",
            "1/22": "51.0",
            "1/23": "57.0",
            "1/24": "55.0",
            "1/25": "59.0",
            "1/26": "56.0",
            "1/27": "60.0",
            "1/28": "66.0"
        },
        "standard": [52, 56],
        "unit": "Kg",
        "title": "体重监测"
    })
})
const reducer=(state=defaultState,action)=>{
    let data = state.getIn(['data', 'data']);
    switch(action.type){
        case "loadDataMonitoring":
            return state.set('data',action.data);
        
        case "delDataMonitoring":
            delete (data[action.key])
            return state;
        case 'changeDataSagaMonitoring':
            data[action.key] = action.value
            return state;
        default: return state;
    }
}

export default reducer;